home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11157 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: news.chalmers.se!usenet
  2. From: Michael Sch=?iso-8859-1?Q?=F6n <ei39418@ios.chalmers.se>?=
  3. Newsgroups: comp.lang.c++
  4. Subject: Exception: GPF and DIV by 0 ?
  5. Date: Tue, 12 Mar 1996 19:40:46 +0000
  6. Organization: Chalmers University of Technology
  7. Message-ID: <3145D33E.208A@ios.chalmers.se>
  8. NNTP-Posting-Host: modem15.ios.chalmers.se
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=iso-8859-1
  11. Content-Transfer-Encoding: quoted-printable
  12. X-Mailer: Mozilla 2.0 (Win16; I)
  13.  
  14. Hello,
  15.  
  16. Does anyone know how to catch the following exceptions in Borland C++ =
  17.  
  18. 4.52:
  19. - General Protection Fault (GPF)
  20. - Division by zero
  21.  
  22. I would like to provide an error handler for these errors.
  23.  
  24. #Solution 1 - does not work:
  25. The following code 'should' catch it:
  26.  
  27. try
  28. {
  29.     // some C++ code - generates the above mentioned exceptions.
  30. }
  31. catch(...)
  32. {
  33.     // This catch ALL statement does not catch the exceptions.
  34.     // Instead Windows report them.
  35. }
  36. #Solution 2 - does not work either:
  37. // Connect an error handler function via the set_unexpected macro.
  38. set_unexpected( My_Own_Error_Handler() )
  39.  
  40.  
  41. Any ideas?
  42. One solution for the division fault is to put an error handler on the DIV =
  43.  
  44. interrupt, but that is not a good solution. There must be a better one.
  45.  
  46. How do one catch a GPF exception?
  47.  
  48. All suggestions are welcome.
  49.  
  50. Regards,
  51. Michael
  52.  
  53. Please report directly to: ei39418@ios.chalmers.se
  54.  
  55. --------------------------------------------------
  56. Michael Sch=F6n
  57. Chalmers University of Technology
  58. E-mail: ei39418@ios.chalmers.se
  59. --------------------------------------------------
  60.